#ifndef WHALEAVATAR_H
#define WHALEAVATAR_H

#include <QLabel>
#include <QImage>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QPixmap>

class QMouseEvent;

class WhaleAvatar : public QLabel {
    Q_OBJECT

    public:
        WhaleAvatar( QString avatarUrl, QString userid );

    public slots:
        void mousePressEvent( QMouseEvent * event );
        void ReadAvatar( QNetworkReply * );
        void WaitForCache();

    private:
        QImage mImage;
        QImage mRealImage;
        QNetworkAccessManager * mConnector;
        QNetworkReply * mAvatarReply;
        QString mAvatarUrl;
        QImage mAvatar;
        QPixmap mAvatarPixmap;
        QString mUserId; // keep this string to be used as a key to QPixmapCache
};

#endif
